package com.note.syschronizedMoudule;

/**
 * @ClassName SychronizedMethodStatic
 * @Description TODO
 * @Author QiBin
 * @Date 2020/6/1718:16
 * @Version 1.0
 **/
public class SychronizedMethodStatic  implements Runnable{
    static SychronizedMethodStatic instance = new SychronizedMethodStatic();
    @Override
    public void run() {
        method();
    }

    public synchronized void method() {
        System.out.println("======="+Thread.currentThread().getName());
        try {
            Thread.sleep(4000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        Thread thread1 = new Thread(instance);
        Thread thread2 = new Thread(instance);

        thread1.start();
        thread2.start();


    }



}
